package com.example.mapper;

import com.example.model.Bill;
import com.example.model.BillItem;
import com.example.model.Customer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface BillMapper {
    @Select("select * from bills where customer=#{customerId}")
    public List<Bill>selectBillByCustomerId(@Param("customerId") Long customerId);

    @Select("select * from bill_items where billId=#{billId}")
    public List<BillItem> selectBillItemsByBillId(@Param("billId")Long updateBill);


    @Update("update bills set totalPrice=#{totalPrice} where id=#{id}")
    public int updateBill(@Param("id")Long id,@Param("totalPrice") BigDecimal totalPrice);
}
